﻿using UnityEditor;
using UnityEngine;

namespace CounterApp.Editor
{
    public class CounterAppEditor : EditorWindow
    {
        [MenuItem("CounterApp/Open")]
        static void Open()
        {
            var window = GetWindow<CounterAppEditor>();
            window.position = new Rect(100F, 100F, 400F, 600F);
            window.titleContent= new GUIContent(nameof(CounterApp));
            window.Show();
        }

        private void OnGUI()
        {
            if (GUILayout.Button("+"))
            {
                new AddCountCommand().Execute();
            }

            GUILayout.Label(CounterModel.Instance.Count.Value.ToString());

            if(GUILayout.Button("-"))
            {
                new SubCountCommand().Execute();
            }
        }
    }
}
